home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tchk21.arc / INCLUDE.ARC / VIDEO.H < prev    next >
C/C++ Source or Header  |  1989-06-20  |  7KB  |  124 lines

  1. /* TCHK 2.1 - Howard Kapustein's Turbo C library        6-6-89      */
  2. /* Copyright (C) 1988,1989 Howard Kapustein.  All rights reserved.  */
  3.  
  4. /* video.h  -  header file for VIDEO.C - screen output routines */
  5.  
  6. #ifndef VIDEO_HEADER
  7. #define VIDEO_HEADER    1
  8.  
  9. #include <howard.h>
  10. #ifndef __VIDEO             /* can't check conio.h again, redefine #defines => errors */
  11. #include <conio.h>          /* struct text_info */
  12. #endif
  13.  
  14. /*  Remember, when #including files, <conio.h> MUST come before <video.h> */
  15.  
  16. #define VIDEO     0x10           /* VIDEO INTerrupt service = 16 (HEX 10) */
  17. #define MODE      *((byte far *) 0x449lu)          /* current video mode */
  18. #define PAGE      *((byte far *) 0x462lu)          /* current display page */
  19. #define PAGELEN   *((unsigned int far *) 0x44Clu)  /* current page length (regen buffer) */
  20. #define VIDOFFSET *((unsigned int far *) 0x44Elu)  /* offset from start of video */
  21. #define ROWCOUNT  *((byte far *) 0x484lu)          /* # rows minus 1 on display (EGA,PGA) */
  22. #define CHARHEIGHT *((unsigned int far *) 0x485lu) /* character height: # bytes/char, # scan lines/char (EGA,PGA) */
  23. #define CURSOR_UNDERBAR   (MODE==7)?0x0B0C:0x0607  /* cursor type: underbar (default) */
  24. #define CURSOR_HALFBLOCK  (MODE==7)?0x070C:0x0407  /* cursor type: half-block */
  25.  
  26. /* Global variables */
  27. /* These have already been defined, they are just listed here for your
  28.    reference. Do not uncomment these variables.
  29.  
  30.    char frame1[11] = {'┌','─','┐','│','┘','─','└','│','\0','┤','├'};
  31.    char frame11[5] = {'┬','├','┴','┤','┼'};
  32.    char frame12[6] = {'╓','╞','╨','╡','╫','╪'};
  33.    char frame2[11] = {'╔','═','╗','║','╝','═','╚','║','\0','╣','╠'};
  34.    char frame21[6] = {'╤','╟','╧','╢','╪','╫'};
  35.    char frame22[5] = {'╦','╠','╩','╣','╬'};
  36.    char frame0[11] = {' ',' ',' ',' ',' ',' ',' ',' ','\0',' ',' '};
  37.    char framebox[11] = { '╒','═','╕','│','╛','═','╘','│','\0','╡','╞' };
  38.    const char emptystring[] = "               ";     /* 15 spaces */
  39.                                                                             */
  40.  
  41. /* Shadow definitions */
  42. #define SHADOW_TL   0x0080              /* shadow top left corner */
  43. #define SHADOW_T    0x0040              /* shadow top side */
  44. #define SHADOW_TR   0x0020              /* shadow top right corner */
  45. #define SHADOW_R    0x0010              /* shadow right side */
  46. #define SHADOW_BR   0x0008              /* shadow bottom right corner */
  47. #define SHADOW_B    0x0004              /* shadow bottom side */
  48. #define SHADOW_BL   0x0002              /* shadow bottom left corner */
  49. #define SHADOW_L    0x0001              /* shadow left side */
  50.  
  51. #define SHADOW_TOP      (SHADOW_TL|SHADOW_T|SHADOW_TR)  /* shadow on top row */
  52. #define SHADOW_BOTTOM   (SHADOW_BL|SHADOW_B|SHADOW_BR)  /* shadow on bottom row */
  53. #define SHADOW_LEFT     (SHADOW_TL|SHADOW_L|SHADOW_BL)  /* shadow on left column */
  54. #define SHADOW_RIGHT    (SHADOW_TR|SHADOW_R|SHADOW_BR)  /* shadow on right column */
  55.  
  56. /* video info */
  57. int center(char *str);              /* @ row,center() SAY ... */
  58. boolean isCGA(void);
  59. boolean isEGA(void);
  60. boolean isHerc(void);
  61. boolean isMDA(void);
  62. byte read_attrib(void);             /* read attribute at cursor */
  63. byte read_char(void);               /* read character at cursor */
  64. void settextinfo(struct text_info *inforec);    /* set TC info according to inforec */
  65. byte whatxy(byte *attrib);          /* read character/attribute at cursor */
  66.  
  67. /* video mode */
  68. void read_mode(byte *width, byte *mode, byte *page);
  69. void set_mode(byte mode);
  70.  
  71. /* line drawing */
  72. int box(int left, int top, int right, int bottom, char frame[]);
  73. void shadow(int left, int top, int right, int bottom, char frame[]);
  74. void horiz_line(byte c, int len, int col, int row);     /* does not update cursor */
  75. void vert_line(byte c, int len, int col, int row);      /* updates cursor */
  76. int boxwindow(int left, int top, int right, int bottom, char frame[],
  77.               char *title, int titlejustify, char colborder, char coltitle,
  78.               char colnorm, char *buffer);
  79.  
  80. /* output */
  81. void putk(byte c);                          /* output 1 char w/attrib, BIOS */
  82. void putsay(int col, int row, byte *c);     /* direct screen writes */
  83. void putstr(byte *c);                       /* INTerrupt output */
  84.  
  85. /* text manipulation */
  86. void gotohv(int horiz, int vert);           /* goto x,y, absolute, not limited by TC 1.5 */
  87. int whereh(void);                           /* wherex(), absolute, not limited by TC 1.5 */
  88. int wherev(void);                           /* wherey(), absolute, not limited by TC 1.5 */
  89. void clear(int left, int top, int right, int bottom);
  90. void scroll_up(int left, int top, int right, int bottom);
  91. void scroll_down(int left, int top, int right, int bottom);
  92.  
  93. /* cursor control */
  94. void cursor_blink(boolean fast);
  95. void cursor_flip(unsigned int curs1, unsigned int curs2);   /* toggle cursor type */
  96. void cursor_off(void);
  97. void cursor_on(void);
  98. unsigned int read_cursor(int *col, int *row);  /* returns CX reg, scan lines */
  99. unsigned int getcursor(void);                  /* returns cursor scan lines */
  100. void setcursor(unsigned int cursor);           /* set cursor scan lines */
  101.  
  102. /* tchk video control */
  103. void set_color(byte colors);
  104.  
  105. /* Compaq Portable Extensions */
  106. unsigned char CompaqGetMonitor(void);               /* Get active monitor (internal/external) */
  107. void CompaqSelectMonitor(boolean internal);         /* Select active monitor (internal/external) */
  108. unsigned char CompaqGetMasterMode(void);            /* Get master mode of current controller */
  109. void CompaqSetMasterMode(unsigned char mastermode); /* Set master mode of current controller */
  110. unsigned char CompaqInternalMonitorType(void);      /* Internal monitor type */
  111. unsigned char CompaqExternalMonitorType(void);      /* External monitor type */
  112. void CompaqModeSwitchDelay(boolean enable);         /* Set mode switch delay */
  113.  
  114.  
  115. #define ismono()            isMDA()|isHerc()
  116. #define iscolor()           !ismono()
  117. #define scrbuff(l,t,r,b)    (b-t+1)*(r-l+1)*2   /* # rows * # cols * 2 */
  118. #define cls()               clrscr()            /* I prefer cls() to clrscr() */
  119. #define color(f,b)          (f|(b<<4))          /* fore/back ground color */
  120. #define set_cursor(h,l)     setcursor(h|l)      /* high and low scan lines */
  121. /*#define gotoxy(x,y)         gotohv(x,y)       uncomment this for my gotoxy(), see docs */
  122.  
  123. #endif              /* VIDEO_HEADER */
  124.